<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
	<%@include file="/include/header.html" %>
	<link rel="stylesheet" href="${ctx}/libjs/plugins/h-ui/css/H-ui.admin.css">
	<link rel="stylesheet" href="${ctx}/libjs/plugins/h-ui/style.css">
	<%--<script src="${ctx}/libjs/jquery.min.js"></script>--%>
	<%--<script src="${ctx}/libjs/bootstrap.js"></script>--%>
	<script type="text/javascript"
			src="https://webapi.amap.com/maps?v=1.3&key=e392de55be62b195115e32b97043a1bd&plugin=AMap.Autocomplete,AMap.PlaceSearch"></script>
	<script type="text/javascript" src="${ctx}/appjs/tenant/user/user.js"></script>
</head>

<script type="text/javascript">
	$('#topLink', window.parent.document).html(function (i, origText) {
		return'<ol class="breadcrumb">' +
				'<li class="breadcrumb-item">' +
				'<a href="">主页</a>' +
				'</li>' +
				'<li class="breadcrumb-item">' +
				'<a>平台设置</a>' +
				'</li>' +
				'<li class="breadcrumb-item">' +
				'<strong>个人信息</strong>' +
				'</li>' +
				'<li class="breadcrumb-item">' +
				'<a href="javascript:window.history.back()"><i class="fa fa-times"></i> 返回</a>' +
				'</li>' +
				'</ol>';
	});
</script>

<body class="gray-bg">
<div class="wrapper wrapper-content ">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox float-e-margins">
				<div class="ibox-title">
					<div class="columns pull-left">
						<h5 class="font-bold">编辑账号</h5>
					</div>
					<div class="ibox-tools">
						<a class="close-link">
							<i class="fa fa-times"></i>
						</a>
					</div>
				</div>
				<div class="ibox-content" id="exampleTable">

					<form class="form-horizontal m-t " id="frmUser">
						<input type="text" class="form-control" id="tenantUserId" name="tenantUserId" value="${tenantUser.tenantUserId}" hidden>
						<div class="form-group row">
							<label class="col-sm-3 col-form-label text-right">上传图片：</label>
							<div class="col-sm-8">
								<div>
									<div>
										<c:choose>
											<c:when test="${tenantUser.headImg !=null && tenantUser.headImg !=''}">
												<img id="headImg" src="${tenantUser.headImg}"
													 width="155px" height="120px">
											</c:when>
											<c:otherwise>
												<img id="headImg" src="${ctx}/statics/img/upload-img.png"
													 style="position: relative" width="155px" height="120px">
											</c:otherwise>
										</c:choose>

										<input type="file" name="file" id="file"/>
									</div>
								</div>
								<span>图片尺寸建议为：<span class="text-danger">60px*60px</span></span>
							</div>
						</div>

						<div class="form-group row">

							<label class="col-sm-3 col-form-label text-right">登录账号：</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="loginName" name="loginName" value="${tenantUser.loginName}">

							</div>
						</div>

						<div class="form-group row ">
							<label class="col-sm-3 col-form-label text-right">姓名：</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" name="realName" id="realName" value="${tenantUser.realName}">
							</div>
						</div>

						<div class="form-group row">
							<label class="col-sm-3 col-form-label text-right">手机号码：</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" name="mobile" id="mobile" value="${tenantUser.mobile}">
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3 col-form-label text-right">密码：</label>
							<div class="col-sm-8">
								<input type="password" class="form-control" name="password" id="password" value="${tenantUser.password}">
							</div>
						</div>


						<div class="form-group row">
							<label class="col-sm-3 col-form-label text-right">性别:</label>
							<div class="col-sm-8">
								<select name="userSex" id="userSex"
										class="form-control chosen-select"
										style="width: 100%">
									<option value="0" selected="selected">男</option>
									<option value="1" <c:if test="${tenantUser.userSex eq '1'}">selected</c:if>>女</option>
								</select>
							</div>
						</div>

						<div class="form-group row">
							<label class="col-sm-3 col-form-label text-right">角色:</label>
                            <div class="col-sm-8">
<%--                                <input type="text" class="form-control" name="tenantRoleId" id="tenantRoleId" value="${role.roleName}" >--%>

								<select name="tenantRoleId" id="tenantRoleId"
										class="form-control chosen-select"
										style="width: 100%"  <c:if test="${tenantUser.userType == '0'}">disabled</c:if>>
									<c:forEach items="${tenantRoleList}" var="role">
										<option value="${role.tenantRoleId}" <c:if test="${role.tenantRoleId == tenantUser.tenantRoleId}">selected</c:if>>${role.roleName}</option>
									</c:forEach>
								</select>
                            </div>
						</div>
						<div class="form-group" style="margin-top: 15px !important;">
							<div class="col-sm-4 col-sm-offset-8 text-right">
								<button type="submit" class="btn btn-success" >提交</button>
							</div>
						</div>
					</form>

				</div>
			</div>
		</div>
	</div>
</div>
<script>

	$("#file").change(function () {
		var file = this.files[0];
		var reg = RegExp(/image/);
		if (!reg.test(file.type)) {
			parent.layer.msg("支持图片上传");
			return;
		}
		var objUrl = getObjectURL(this.files[0]);//获取文件信息
		if (objUrl) {
			$("#headImg").attr("src", objUrl);
		}
	});

	function getObjectURL(file) {
		var url = null;
		if (window.createObjectURL != undefined) {
			url = window.createObjectURL(file);
		} else if (window.URL != undefined) { // mozilla(firefox)
			url = window.URL.createObjectURL(file);
		} else if (window.webkitURL != undefined) { // webkit or chrome
			url = window.webkitURL.createObjectURL(file);
		}
		return url;
	}
	editUser.init();


</script>
</body>
</html>
